package main

import (
	"fmt"
	"github.com/ifaceless/always-coding/datastructure/dict"
	"time"
)

func main()  {
	d := dict.New()
	d.Store("hello", "world")
	d.Store("name", "0xE8551CCB")
	d.Store(100, 200)

	for i := 0; i < 10; i++ {
		d.Store(i, i)
	}

	fmt.Println(d)
	fmt.Println(d.Load("hello"))
	fmt.Println(d.LoadOrStore("language", "Eng"))

	d.Range(func(key, value interface{}) bool {
		fmt.Println(key, "=>", value)
		return true
	})

	for i := 0; i<10;i++ {
		d.Delete(i)
	}

	_ = d.Resize()
	fmt.Println(d)

	d.RehashForAWhile(1 * time.Microsecond)
	fmt.Println(d)
}
